# -*- coding: utf-8 -*-
"""
Created on Sat Nov 05 16:41:44 2016

@author: jocke_000
"""
import operator
import numpy as np

a = {'a': 2, 'c': 1, 'b': 3, 'd': 0}
print a
b = sorted(a.iteritems(), key=operator.itemgetter(0), reverse=False)
print b
c = sorted(a.iteritems(), key=operator.itemgetter(1), reverse=False)
print c

mat1 = np.mat(([10,-13], [22,15], [3,12], [-7,9]), dtype=int)
print mat1
lst1 = sorted(mat1.iteritems(), key=operator.itemgetter(1), reverse=False)
print lst1

arr1 = np.array(mat1)
lst1 = zip(range(len(arr1)), arr1[:,0])
print lst1
lst2 = sorted(lst1, key=operator.itemgetter(0), reverse=True)
print lst2
for i in range(len(lst2)):
    print lst2[i][0], lst2[i][1]
    
